// ==UserScript==
// @name         CopyOnClick
// @namespace    http://tampermonkey.net/
// @version      0.22
// @description  Fill the scores automatically
// @author       Xiaoniu29
// @match        https://www.cfmem.com/*vpn.html
// @require      https://www.tenpay.com/v4/static/js/jquery-1.12.4.min.js
// @require      https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js
// @require      https://gitee.com/sobweb/FillScore/raw/master/poplayer.js

// ==/UserScript==
const insP = document.querySelector('#post-body > div > h2:nth-child(7)');
const cpyNode = document.createElement("button")
cpyNode.innerHTML = '&emsp;<a style="color: #1E73BE; border-radius: 6px; border: 1px solid #1E73BE; padding: 3px;" data-clipboard-action="copy" data-clipboard-target="#post-body > div > div:nth-child(8) > pre > span" id="copy_btn">一键复制</a> ';
var cpyBtn = insP.insertBefore(cpyNode, insP.firstElementChild);

$(document).ready(function(){
    var clipboard = new Clipboard('#copy_btn');
    clipboard.on('success', function(e) {
        poplayer.msg('复制成功！',2);
        e.clearSelection();
    });
});